package org.fuys.coder.domain.substance.model.vo;

/**
 * @projectName: fuys-low-coder
 * @package: org.fuys.coder.domain.substance.model.vo
 * @className: SubstanceFileTypeVO
 * @author: WangJing
 * @description: 内容文件类型枚举
 * @date: 2024/7/15 0:00
 * @version: 1.0
 */
public enum SubstanceFileTypeVO {
    HTML(1){
        @Override
        public String getDesc(){
            return "HTML";
        }
    },
    CSS(2){
        @Override
        public String getDesc(){
            return "CSS";
        }
    },
    JS(3){
        @Override
        public String getDesc(){
            return "JS";
        }
    },
    IMAGE(4){
        @Override
        public String getDesc(){
            return "IMAGE";
        }
    }
    ;
    private int idx;
    SubstanceFileTypeVO(int idx){
        this.idx=idx;
    }

    public int getIdx() {
        return idx;
    }

    public String getDesc(){
        return "UNKNOWN";
    }

    public static String desc(int idx){
        final SubstanceFileTypeVO[] values = SubstanceFileTypeVO.values();
        if(values.length<idx-1){
            return "UNKNOWN";
        }else{
            return values[idx-1].getDesc();
        }
    }
    public static boolean contains(int idx){
        return 1<=idx&&idx<=4;
    }
}
